/**
 * 
 */
package com.gmail.at.dengtooling.examples;

import java.util.logging.Logger;

import com.gmail.at.dengtooling.Connection;
import com.gmail.at.dengtooling.Session;
import com.gmail.at.dengtooling.api.Listener;
import com.gmail.at.dengtooling.packets.KeyExchange;

/**
 * @author Deng Tooling
 * @version 1.0
 */
public class Demo {
	public static void main(String[] args) {
		Connection connection = Connection.getInstance();
		Session session = new Session(connection);
		session.setListener(new Listener() {
			private final Logger LOGGER = Logger.getLogger("Listener");
			public void onReciveKeyExchange(KeyExchange keyExchange) {
				// TODO Auto-generated method stub
				LOGGER.info(keyExchange.toString());
			}

			public void onRecieveSayHello(byte[] buffer) {
				// TODO Auto-generated method stub
				LOGGER.info(new String(buffer));
			}

			public void onSendKeyExchange(KeyExchange keyExchange) {
				// TODO Auto-generated method stub
				LOGGER.info(keyExchange.toString());
			}

			public void onSendSayHello(byte[] buffer) {
				// TODO Auto-generated method stub
				LOGGER.info(new String(buffer));
			}
		});
		
		session.init();
		
		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
		}
	}
}
